package com.zlc.platform.service.impl;

import com.github.pagehelper.PageHelper;
import com.zlc.common.common.entity.PageVo;
import com.zlc.common.core.sys.mapper.MayanSysLogMapper;
import com.zlc.common.core.sys.model.vo.MayanSysLogVo;
import com.zlc.common.model.sys.LoginLogRequest;
import com.zlc.common.model.sys.OperateLogRequest;
import com.zlc.platform.service.SysLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SysLogServiceImpl implements SysLogService {

    @Autowired
    private MayanSysLogMapper mayanSysLogMapper;

    @Override
    public PageVo<MayanSysLogVo> findLoginLog(LoginLogRequest request) {
        PageHelper.startPage(request.getPageNum(),request.getPageSize());
        List<MayanSysLogVo> loginLog = mayanSysLogMapper.findLoginLog(request);
        return PageVo.page(loginLog);
    }

    @Override
    public PageVo<MayanSysLogVo> findOperateLog(OperateLogRequest request) {
        PageHelper.startPage(request.getPageNum(),request.getPageSize());
        List<MayanSysLogVo> operateLog = mayanSysLogMapper.findOperateLog(request);
        return PageVo.page(operateLog);
    }
}
